home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include <dos.h>
- #include "define.h"
-
- #ifdef DEBUG
- main(int argc, char *argv[])
- {
- struct TIMEADRS time;
-
- if (argc > 1) {
- printf("input is %s\n", argv[1]);
- time.min = (u_char) atoi(argv[1]);
- time.sec = 0;
- time.frame = 0;
- printf("Seek %d分\n", time.sec);
- printf("return is %x\n", cdr_tseek(0, &time));
- }
- }
- #endif
-
- /* 指定位置へのシーク(時間指定) */
- /*
- * decice_no: device number (Towns CD-ROM -> 0)
- * time: 時間
- * return: 0 -> 正常終了, 0以外 -> エラー
- */
- int cdr_tseek(int device_no, struct TIMEADRS *time)
- {
- union REGS reg;
-
- if (time == NULL) {
- return -1;
- }
- reg.h.ah = 0x14;
- reg.h.al = (0xC0 | (u_char) device_no);
- reg.x.cx = 0x0000;
- reg.h.cl = (u_char) time->min; /* 分 */
- reg.h.dh = (u_char) time->sec; /* 秒 */
- reg.h.dl = (u_char) time->frame; /* フレーム */
-
- int86(0x93, ®, ®);
-
- if (reg.h.ah == 0) {
- return 0;
- } else if (reg.h.ah == 0x02) { /* device number error */
- return DEVERR;
- } else if (reg.h.ah == 0x10) { /* cd-da plaing */
- return DEVPLY;
- } else { /* (reg.h.ah == 0x80) hard ware error */
- return reg.x.cx;
- }
- }
-
-